<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png">
    <h1>{{ showZhangchao }}</h1>
    <h1>{{ showZhangyue() }}</h1>
    <h1>{{ msg }}</h1>
    <input v-model="aaa">
    <HelloWorld msg="hello world2" />
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
import { mixin } from "@/mixins.js";

export default {
  name: 'home',
  components: {
    HelloWorld
  },
  data() {
    var msg1 = 'test'
    return {
      msg: msg1,
      aaa: ''
    }
  },
  methods: {
    showZhangyue() {  
      let dt = new Date()
      return dt.toTimeString()
    },
    zhangyue(){
      return 'zhangyue'
    },
    hello(){
            console.log('hello world')
        }
  },
  created() {
    this.hello()
    window.console.log('初始化完成')
  },
  updated() {
    window.console.log('我更新了')
  },
  mounted() {

  },
  computed: {
    showZhangchao(){
      let dt = new Date()
      return dt.toTimeString()
    }
  },
  watch: {
    aaa(value) {
      if (value.length < 6) {
        this.msg = '密码不能少于6位'
      }else {
        this.msg = '密码可以使用'
      }
    }
  },
  mixins:[mixin]
}
</script>
